def putin():
return map(int, input().split())
def solve():
n = int(input())
s = input()
r = input()
pairs = []
for i in range(len(s)):
pairs.append(
tuple(sorted([s[i], r[n-1-i]]))
)
D = {}
for elem in pairs:
if elem in D:
D[elem] += 1
else:
D[elem] = 1
odd = 0
for elem in D:
if D[elem] % 2 == 1:
if elem[0] != elem[1]:
return "NO"
odd += 1
return "YES" if odd < 2 else "NO"
t = int(input())
for i in range(t):
print(solve())
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |